﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LPT_5
{
    public partial class LoginForm : Form
    {
        private FormManager.LoginCallback mcbLoginCall = null;
        private FormManager.ExitCallback mcbExitCall = null;

        public LoginForm(FormManager.LoginCallback cbLogin,FormManager.ExitCallback cbExit)
        {
            mcbLoginCall = cbLogin;
            mcbExitCall = cbExit;
            InitializeComponent();
        }

        private void cmdLogin_Click(object sender, EventArgs e)
        {
            cmdLogin.Text = "Logging in";
            cmdLogin.Enabled = false;
            mcbLoginCall.Invoke(txtUsername.Text, txtPassword.Text);
        }

        private void LoginForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            mcbExitCall.Invoke();
        }
    }
}
